package business.command
{
	import business.event.SearchUserByUserIdEvent;
	import business.modelLocators.UserModelLocator;
	import business.service.delegate.BusinessAMDelegate;
	
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.rpc.IResponder;
	import mx.controls.Alert;
	import valueObjects.User;
	
	public class SearchUserByUserIdCommand implements ICommand, IResponder
	{
		[Bindable]
		private var userModel:UserModelLocator;
		public function SearchUserByUserIdCommand()
		{
			
		}
		public function execute(event:CairngormEvent):void {
			var userId:String = (event as SearchUserByUserIdEvent).userId;
			var businessAM:BusinessAMDelegate = new BusinessAMDelegate(this);
			businessAM.getUserByUserId(userId);
		}
		public function result(result:Object):void {
			userModel = UserModelLocator.getInstance();
			userModel.searchUser = result.result as User;
		}
		public function fault(info:Object):void {
			
		}
	}
}